package cn.portx.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.bstek.bdf3.dorado.jpa.annotation.Generator;
import com.bstek.dorado.annotation.PropertyDef;

import cn.portx.annotation.ChineseField;
import cn.portx.policy.ChineseToCodeGeneratorPolicy;
import cn.portx.policy.CreateUserPolicy;
import cn.portx.policy.CreatedDatePolicy;
import cn.portx.policy.IdGeneratorPolicy;

/**
 * Model class of 工厂.
 * 
 * @author generated by ERMaster
 * @version $Id$
 */
@Entity
@Table(name = "T_FACTORY")
public class Factory extends BaseEntity {

	/** serialVersionUID. */
	private static final long serialVersionUID = 1L;

	/** 工厂代码. */
	@Column(name = "CODE_", length = 60)
	@ChineseField("name")
	@Generator(policy = ChineseToCodeGeneratorPolicy.class)
	@PropertyDef(label = "工厂代码", description = "工厂代码:工厂代码")
	private String code;

	/** 工厂名称. */
	@Column(name = "NAME_", length = 100)
	@PropertyDef(label = "工厂名称", description = "工厂名称:工厂名称")
	private String name;

	/** 工厂地址. */
	@Column(name = "ADDRESS_", length = 200)
	@PropertyDef(label = "工厂地址", description = "工厂地址:工厂地址")
	private String address;

	/** 装卸地点. */
	@Column(name = "ZXDD_", length = 200)
	@PropertyDef(label = "装卸地点", description = "装卸地点:装卸地点")
	private String zxdd;

	/** 联系人. */
	@Column(name = "CONTACT_", length = 20)
	@PropertyDef(label = "联系人", description = "联系人:联系人")
	private String contact;

	/** 联系电话. */
	@Column(name = "TEL_", length = 20)
	@PropertyDef(label = "联系电话", description = "联系电话:联系电话")
	private String tel;

	/** 手机号. */
	@Column(name = "PHONE_", length = 11)
	@PropertyDef(label = "手机号", description = "手机号:手机号")
	private String phone;

	/** 传值. */
	@Column(name = "FAX_", length = 30)
	@PropertyDef(label = "传值", description = "传值:传值")
	private String fax;

	/** 邮箱. */
	@Column(name = "MAIL_", length = 60)
	@PropertyDef(label = "邮箱", description = "邮箱:邮箱")
	private String mail;

	/** QQ. */
	@Column(name = "QQ_", length = 15)
	@PropertyDef(label = "QQ", description = "QQ:QQ")
	private String qq;

	/** 备注. */
	@Column(name = "REMARK_", length = 300)
	@PropertyDef(label = "备注", description = "备注:备注")
	private String remark;

	/** 所属客户ID. */
	@Column(name = "CUSTOMER_ID_", length = 60)
	@PropertyDef(label = "所属客户ID", description = "所属客户ID:所属客户ID")
	private String customerId;

	@Transient
	private Customer customer;

	/**
	 * Constructor.
	 */
	public Factory() {
	}

	/**
	 * Set the 工厂代码.
	 * 
	 * @param code
	 *            工厂代码
	 */
	public void setCode(String code) {
		this.code = code;
	}

	/**
	 * Get the 工厂代码.
	 * 
	 * @return 工厂代码
	 */
	public String getCode() {
		return this.code;
	}

	/**
	 * Set the 工厂名称.
	 * 
	 * @param name
	 *            工厂名称
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Get the 工厂名称.
	 * 
	 * @return 工厂名称
	 */
	public String getName() {
		return this.name;
	}

	/**
	 * Set the 工厂地址.
	 * 
	 * @param address
	 *            工厂地址
	 */
	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * Get the 工厂地址.
	 * 
	 * @return 工厂地址
	 */
	public String getAddress() {
		return this.address;
	}

	/**
	 * Set the 装卸地点.
	 * 
	 * @param zxdd
	 *            装卸地点
	 */
	public void setZxdd(String zxdd) {
		this.zxdd = zxdd;
	}

	/**
	 * Get the 装卸地点.
	 * 
	 * @return 装卸地点
	 */
	public String getZxdd() {
		return this.zxdd;
	}

	/**
	 * Set the 联系人.
	 * 
	 * @param contact
	 *            联系人
	 */
	public void setContact(String contact) {
		this.contact = contact;
	}

	/**
	 * Get the 联系人.
	 * 
	 * @return 联系人
	 */
	public String getContact() {
		return this.contact;
	}

	/**
	 * Set the 联系电话.
	 * 
	 * @param tel
	 *            联系电话
	 */
	public void setTel(String tel) {
		this.tel = tel;
	}

	/**
	 * Get the 联系电话.
	 * 
	 * @return 联系电话
	 */
	public String getTel() {
		return this.tel;
	}

	/**
	 * Set the 手机号.
	 * 
	 * @param phone
	 *            手机号
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	/**
	 * Get the 手机号.
	 * 
	 * @return 手机号
	 */
	public String getPhone() {
		return this.phone;
	}

	/**
	 * Set the 传值.
	 * 
	 * @param fax
	 *            传值
	 */
	public void setFax(String fax) {
		this.fax = fax;
	}

	/**
	 * Get the 传值.
	 * 
	 * @return 传值
	 */
	public String getFax() {
		return this.fax;
	}

	/**
	 * Set the 邮箱.
	 * 
	 * @param mail
	 *            邮箱
	 */
	public void setMail(String mail) {
		this.mail = mail;
	}

	/**
	 * Get the 邮箱.
	 * 
	 * @return 邮箱
	 */
	public String getMail() {
		return this.mail;
	}

	/**
	 * Set the QQ.
	 * 
	 * @param qq
	 *            QQ
	 */
	public void setQq(String qq) {
		this.qq = qq;
	}

	/**
	 * Get the QQ.
	 * 
	 * @return QQ
	 */
	public String getQq() {
		return this.qq;
	}

	/**
	 * Set the 备注.
	 * 
	 * @param remark
	 *            备注
	 */
	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * Get the 备注.
	 * 
	 * @return 备注
	 */
	public String getRemark() {
		return this.remark;
	}

	/**
	 * Set the 所属客户ID.
	 * 
	 * @param customeId
	 *            所属客户ID
	 */
	public void setCustomerId(String customerId) {
		this.customerId = customerId;
	}

	/**
	 * Get the 所属客户ID.
	 * 
	 * @return 所属客户ID
	 */
	public String getCustomerId() {
		return this.customerId;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
		return result;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Factory other = (Factory) obj;
		if (this.getId() == null) {
			if (other.getId() != null) {
				return false;
			}
		} else if (!this.getId().equals(other.getId())) {
			return false;
		}
		return true;
	}

}
